


***********************************************************************************
************************** Analysis ********************************************
***********************************************************************************
* Binscatter figures in the appendix
*twoway (line Vix Year  if Id == 1140101 )
*set matsize 10000
* Linear
*binscatter dRight Risk , absorb(Id) control(i.Year##i.Mid) nquantiles(20)
* Quadratic
*binscatter dRight Risk , absorb(Id) line(qfit) control(i.Year##i.Mid) nquantiles(20)



********************************************************************************
********************************** Table 1 *************************************
********************************************************************************

* Column 1
eststo clear
eststo: qui reghdfe d.Right Risk , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "No" , replace
estadd local control2 "No" , replace
estadd local control3 "No" , replace
estimates store Risk_cost1

* Column 2 
eststo: qui reghdfe d.Right Risk  c.( Inequality Share_Finance98 Owners98)##i.Year , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "Yes" , replace
estadd local control2 "No" , replace
estadd local control3 "No" , replace
estimates store Risk_cost2

* Column 3 
eststo: qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )  , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "Yes" , replace
estadd local control2 "Yes" , replace
estadd local control3 "No" , replace
estimates store Risk_cost3

* Column 4  
eststo: qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id ) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "Yes" , replace
estadd local control2 "Yes" , replace
estadd local control3 "Yes" , replace
estimates store Risk_cost4

* Exporting Table (Returns)
* Exporting Table (Returns)
esttab Risk_cost1 Risk_cost2 Risk_cost3 Risk_cost4  , se title(Interest payments and support for local coalition) keep(Risk _cons ) ///
star(* .10 ** .05 *** .01) mtitles("1" "2" "3" "4" )   nonumbers ///
s(N year trend control control2 control3 , label("" "Municipality by year effects" "District fixed effect" "Initial charactaristics \times election effects " "Time-varyin controls" "Controls $\times$ Risky-to-total-asset ratio"  )) ///
replace

********************************************************************************
********************** Unobserved heterogeniety Figure 5 ***********************
********************************************************************************
* Main-result
qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )  , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estimates store Trend1
* Non linear trends
qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )  , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estimates store Trend2
* Second-diffrence 
qui reghdfe d2.Right d.Risk c.(Inequality Share_Finance98 Owners98 )##i.Year  Finacial_share c.(d2.LoneInk d2.NP d.GHW d2.Migrant d2.Age d2.Agesq d2.Voters )  , absorb(i.Mid##i.Year) vce(cluster Id)
estimates store Trend3
* Second-diffrence  with non-linear trends
qui reghdfe d3.Right d2.Risk c.(Inequality Share_Finance98 Owners98 )##i.Year Finacial_share c.(d2.LoneInk d2.NP d.GHW d2.Migrant d2.Age d2.Agesq d2.Voters )  , absorb(i.Mid##i.Year) vce(cluster Id)
estimates store Trend4

coefplot (Trend1, label(First diffrence & linear-trends)) (Trend2, label(First diffrence & quadratic-trends)) (Trend3, label(Second-diffrence estimator)) (Trend4, label(Third-diffrence estimator ))  , ///
keep(Risk D.Risk D2.Risk) yline(0) vertical byopts(xrescale) ciopts(recast(rcap)) xlabel(, nolabels)  bylabel(Linear) norecycle  title("")

********************************************************************************
********************* Individual parties Figure 6 ******************************
********************************************************************************
* Estimations
* Column 1: Left Party: 
qui reghdfe d.Share_V c.( Inequality Share_Finance98 Owners98)##i.Year   Risk c.( Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id##c.Finacial_share ) vce(cluster Id)
estimates store LP
* Column 2: Social Democrats
qui reghdfe d.Share_S  c.( Inequality Share_Finance98 Owners98)##i.Year  Risk c.( Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id##c.Finacial_share ) vce(cluster Id)
estimates store SDP
* Column 3: Green Party
qui reghdfe d.Share_MP c.( Inequality Share_Finance98 Owners98)##i.Year  Risk c.( Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id##c.Finacial_share ) vce(cluster Id)
estimates store GP
qui reghdfe d.Share_L  c.( Inequality Share_Finance98 Owners98)##i.Year  Risk c.( Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id##c.Finacial_share ) vce(cluster Id)
estimates store L
* Column 2: Social Democrats
qui reghdfe d.Share_C  c.( Inequality Share_Finance98 Owners98)##i.Year  Risk c.( Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id##c.Finacial_share ) vce(cluster Id)
estimates store CP
* Column 3: Green Party
qui reghdfe d.Share_KD c.( Inequality Share_Finance98 Owners98)##i.Year  Risk c.( Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id##c.Finacial_share ) vce(cluster Id)
estimates store CD
* Column 4: Moderate Party
qui  reghdfe d.Share_M c.( Inequality Share_Finance98 Owners98)##i.Year  Risk c.( Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id##c.Finacial_share ) vce(cluster Id)
estimates store MP
* Figure
#delimit;
coefplot
(LP, keep(Risk) msymbol(D) mcolor(cranberry) ciopts(color(cranberry) recast(rcap)))
(SDP, keep(Risk) msymbol(D) mcolor(red) ciopts(color(red) recast(rcap)))
(GP, keep(Risk) msymbol(D) mcolor(green) ciopts(color(green) recast(rcap)))
(CD, keep(Risk) msymbol(S) mcolor(navy) ciopts(color(navy) recast(rcap)))
(CP, keep(Risk) msymbol(S) mcolor(midgreen) ciopts(color(midgreen) recast(rcap)))
(L, keep(Risk) msymbol(S) mcolor(eltblue) ciopts(color(eltblue) recast(rcap)))
(MP, keep(Risk) msymbol(S) mcolor(blue) ciopts(color(blue) recast(rcap)))
, graphregion(col(white)) bgcol(white) vertical yline(0)  aseq legend(off) swapnames 
;

********************************************************************************
************************ Goverment support and risk figure 7 *******************
********************************************************************************

* All governments
qui reghdfe Incumbent_local Risk c.(d.Voters d.NP Migrant d.Education d.Age d.Agesq d.LoneInk  GHW)##c.Finacial_share c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share c.( Inequality Share_Finance98 Owners98)##i.Year  , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estimates store Gov
* Left support left wing governments
qui reghdfe d.Left c.Risk##c.Right_coalition c.(d.Voters d.NP Migrant d.Education d.Age d.Agesq d.LoneInk  GHW)##c.Right_coalition c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share c.( Inequality Share_Finance98 Owners98)##i.Year   , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estimates store LEFTLEFT
* Left support right wing governments
qui reghdfe d.Left c.Risk##c.Left_coalition c.(d.Voters d.NP Migrant d.Education d.Age d.Agesq d.LoneInk  GHW)##c.Left_coalition c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share c.( Inequality Share_Finance98 Owners98)##i.Year    , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estimates store LEFTRIGHT
* Right support right wing governments
qui reghdfe d.Right c.Risk##c.Left_coalition c.(d.Voters d.NP Migrant d.Education d.Age d.Agesq d.LoneInk  GHW)##c.Left_coalition  c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share c.( Inequality Share_Finance98 Owners98)##i.Year   , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estimates store RIGHTRIGHT
* Right support left wing governments
qui reghdfe d.Right c.Risk##c.Right_coalition c.(d.Voters d.NP Migrant d.Education d.Age d.Agesq d.LoneInk  GHW)##c.Right_coalition  c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share c.( Inequality Share_Finance98 Owners98)##i.Year  , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estimates store RIGHTLEFT

* Figure
#delimit;
coefplot
(Gov, keep(Risk) msymbol(D) mcolor(cranberry) ciopts(color(cranberry) recast(rcap)))
(LEFTLEFT, keep(Risk) msymbol(D) mcolor(red) ciopts(color(red) recast(rcap)))
(LEFTRIGHT, keep(Risk) msymbol(D) mcolor(green) ciopts(color(green) recast(rcap)))
(RIGHTRIGHT, keep(Risk) msymbol(S) mcolor(navy) ciopts(color(navy) recast(rcap)))
(RIGHTLEFT, keep(Risk) msymbol(S) mcolor(eltblue) ciopts(color(eltblue) recast(rcap)))
, graphregion(col(white)) bgcol(white) vertical yline(0)  aseq legend(off) swapnames
;



********************************************************************************
**************************** Risk per owner Table 2 ****************************
********************************************************************************

* Analys
* Kolumn 1
eststo clear
eststo: qui reghdfe d.Right Risk_po , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "No" , replace
estadd local control2 "No" , replace
estadd local control3 "No" , replace
estimates store Risk_cost1

* Kolumn 2 
eststo: qui reghdfe d.Right Risk_po  c.( Inequality Share_Finance98 Owners98)##i.Year , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "Yes" , replace
estadd local control2 "No" , replace
estadd local control3 "No" , replace
estimates store Risk_cost2

* Kolumn 3 
eststo: qui reghdfe d.Right Risk_po  c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )  , absorb(i.Mid##i.Year i.Id) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "Yes" , replace
estadd local control2 "Yes" , replace
estadd local control3 "No" , replace
estimates store Risk_cost3

* Kolumn 4  
eststo: qui reghdfe d.Right Risk_po  c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share_po , absorb(i.Mid##i.Year i.Id ) vce(cluster Id)
estadd local year "Yes" , replace
estadd local trend "Yes" , replace
estadd local control "Yes" , replace
estadd local control2 "Yes" , replace
estadd local control3 "Yes" , replace
estimates store Risk_cost4

* Exporting Table (Returns)
* Exporting Table (Returns)
esttab Risk_cost1 Risk_cost2 Risk_cost3 Risk_cost4 , se title(Interest payments and support for local coalition) keep(Risk_po _cons ) ///
star(* .10 ** .05 *** .01) mtitles("1" "2" "3" "4" )   nonumbers ///
s(N year trend control control2 control3 , label("" "Municipality by year effects" "District fixed effect" "Initial charactaristics \times election effects " "Time-varyin controls" "Controls $\times$ Risky-to-total-asset ratio"  )) ///
replace


********************************************************************************
**************************** Risk per owner Table 4 ****************************
********************************************************************************

* Cluster analys
xtile Quantiles1 = Finacial_share, nquantiles(20)
xtile Quantiles2 = Finacial_share, nquantiles(50)
xtile Quantiles3 = Finacial_share, nquantiles(100)


* Kolumn fem med "municipality by year fixed effects", kontrollvariabler och kontrollvariabler multiplicerat med "hwpo" och "GHW" samt fixa-effekter p� distriktsniv�  
eststo: qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id ) vce(cluster Id)
estadd local year "Yes" , replace
estadd local control "Yes" , replace
estadd local trend1 "Yes" , replace
estadd local trend2 "Yes" , replace
estadd local cluster "District level" , replace
estimates store Cluster1

* Kolumn fem med "municipality by year fixed effects", kontrollvariabler och kontrollvariabler multiplicerat med "hwpo" och "GHW" samt fixa-effekter p� distriktsniv�  
eststo: qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id ) vce(cluster Quantiles1)
estadd local year "Yes" , replace
estadd local control "Yes" , replace
estadd local trend1 "Yes" , replace
estadd local trend2 "Yes" , replace
estadd local cluster "20" , replace
estimates store Cluster2

* Kolumn fem med "municipality by year fixed effects", kontrollvariabler och kontrollvariabler multiplicerat med "hwpo" och "GHW" samt fixa-effekter p� distriktsniv�  
eststo: qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id ) vce(cluster Quantiles2)
estadd local year "Yes" , replace
estadd local control "Yes" , replace
estadd local trend1 "Yes" , replace
estadd local trend2 "Yes" , replace
estadd local cluster "50" , replace
estimates store Cluster3

* Kolumn fem med "municipality by year fixed effects", kontrollvariabler och kontrollvariabler multiplicerat med "hwpo" och "GHW" samt fixa-effekter p� distriktsniv�  
eststo: qui reghdfe d.Right Risk c.(Inequality Share_Finance98 Owners98)##i.Year c.(d.LoneInk d.NP GHW d.Migrant d.Age d.Agesq d.Voters )##c.Finacial_share , absorb(i.Mid##i.Year i.Id ) vce(cluster Quantiles3)
estadd local year "Yes" , replace
estadd local control "Yes" , replace
estadd local trend1 "Yes" , replace
estadd local trend2 "Yes" , replace
estadd local cluster "100" , replace
estimates store Cluster4

* Exporting Table (Returns)
esttab Cluster1 Cluster2 Cluster3 Cluster4 , se title(Interest payments and support for local coalition) keep(Risk _cons ) ///
star(* .10 ** .05 *** .01) mtitles("1" "2" "3" "4" )   nonumbers scalars(r2) ///
s(N r2 year control trend1 trend2 cluster , label("" "" "Municipality by year effects" "Time variant controls" "Linear trends" "Non-linear trends" "clusters" )) ///
replace


